package com.online.shopping.controller;

import com.online.shopping.pojo.TbItemCat;
import com.online.shopping.service.ItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/itemCat_ms")
public class ItemCatController {

	@Autowired
	private ItemCatService itemCatService;

	@GetMapping("/findAll")
	public List findAll(){
		return itemCatService.findAll();
	}

	@GetMapping("/findByParentId")
	public List findByParentId(Long parentId){
		return itemCatService.findByParentId(parentId);
	}

	@GetMapping("/findOne")
	public TbItemCat findOne(Long id){
		return itemCatService.findOne(id);
	}
}
